<template>
	<view class="common_bottom">
		<u-tabbar activeColor="#19afc9" @change="gotoLink" :value="c_value" :placeholder="false" :fixed="true"
			:safeAreaInsetBottom="false">

			<!-- 	<u-tabbar-item text="勘查" name="1" v-if="kc_dot" dot></u-tabbar-item>
			<u-tabbar-item text="勘查" v-else  name="1"></u-tabbar-item>
			<u-tabbar-item text="安装" v-if="kz_dot" dot name="2"></u-tabbar-item>
			<u-tabbar-item text="安装" v-else name="2"></u-tabbar-item> -->

			<u-tabbar-item text="勘查" name="1" :dot="survey_num"></u-tabbar-item>
			<u-tabbar-item text="安装" name="2" :dot="engin_num"></u-tabbar-item>
			<u-tabbar-item text="巡检" name="3" :dot="onsite_num"></u-tabbar-item>
			<u-tabbar-item text="维修" name="4" :dot="main_num"></u-tabbar-item>
			<u-tabbar-item text="我的" name="5"></u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
	import {
		api,
		apiBaseUrl,
		http
	} from '@/config/common.js'
	export default {
		data() {
			return {
				engin_num:false,
				main_num:false,
				survey_num:false,
				onsite_num:false
			};
		},
		props: {
			c_value: {
				type: String,
				default: 0
			},

			kz_dot: {
				type: Boolean,
				default: false
			},
		},
		name: 'bottom',

		created() {},
		methods: {
			getDot() { 
				api.post('api/shop/little_reddot_data', {}).then(res => { 
					let rst = res.data
					if (rst.code == 1) { 
						this.engin_num = rst.data.engin_num
						this.main_num = rst.data.main_num
						this.survey_num = rst.data.survey_num
						this.onsite_num = rst.data.onsite_num 
					} 
				}).catch(err => {
					uni.hideLoading()
				})
			},
			gotoLink(e) {
				this.c_value = e
				switch (e) {
					case "1":
						uni.navigateTo({
							url: '/pages/kcsj/index'
						})
						break;
					case "2":
						uni.navigateTo({
							url: '/pages/gcaz/index'
						})
						break;
					case "3":
						uni.navigateTo({
							url: '/pages/xj/home'
						})
						break;
					case "4":
						uni.navigateTo({
							url: '/pages/gcwx/index'
						})
						break;
					case "5":
						uni.navigateTo({
							url: '/pages/my/index'
						})
						break;

					default:
						break;
				}
			}
		}
	}
</script>

<style>
	::v-deep .u-tabbar-item__text {
		font-size: 14px;
	}
</style>